# min palindrom

s = input()
p_found = False

for pl in range(2, 4):

    dp = {}
    mink = 'a' * pl  
    for i in range(len(s)-pl+1):
        key = s[i:i+pl]
        if key == mink:
            print(mink)
            p_found = True 
            break
        if key not in dp:
            dp[key] = 0
    if p_found:
        break
    lp = sorted(dp.keys())
    for i in range(len(lp)):
        p = lp[i]
        if p[0] == p[-1]: 
            print(p)
            p_found = True
            break
    if p_found:
        break
else:
    print(-1)

# empty string
